/**
 * 用户分组管理-获取分组列表
 * 无参数
 */
function apiGetGroupList() {
  console.log("apiGetGroupList");
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
      data: [
        {
          id: 1,
          name: "分组1",
        },
        {
          id: 2,
          name: "分组2",
        },
        {
          id: 3,
          name: "分组3",
        },
        {
          id: 4,
          name: "测试分组666666666666666666666666666",
        },
      ],
    };
    const err = {
      code: 500,
      msg: "获取分组列表失败",
    };
    setTimeout(() => {
      resolve(res);
      // reject(err);
    }, 500);
  });
}
/**
 * 用户分组管理-获取分组用户列表
 * @param {number} data.id - 分组id
 * @param {number} data.pageNumber - 当前页
 * @param {number} data.pageSize - 每页条数
 */
function apiGetGroupUserList(data) {
  console.log("apiGetGroupUserList:", data);
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
      data: [
        {
          id: 1,
          name: "张三",
          phone: "13800138000,13800138000, 13800138000,13800138000",
        },
        {
          id: 2,
          name: "李四",
          phone: "13800138001",
        },
        {
          id: 3,
          name: "王五",
          phone: "13800138002",
        },
        {
          id: 4,
          name: "赵六",
          phone: "13800138003",
        },
        {
          id: 5,
          name: "田七",
          phone: "13800138004",
        },
        {
          id: 6,
          name: "王八",
          phone: "13800138005",
        },
        {
          id: 7,
          name: "九九",
          phone: "13800138006",
        },
        {
          id: 8,
          name: "九九",
          phone: "13800138007",
        },
        {
          id: 9,
          name: "九九",
          phone: "13800138008",
        },
        {
          id: 10,
          name: "九九",
          phone: "13800138009",
        },
      ],
      total: 99,
    };
    setTimeout(() => {
      resolve(res);
    }, 500);
  });
}
/**
 * 用户分组管理-添加分组
 * @param {string} data.name - 分组名
 */
function apiGroupAdd(data) {
  console.log("apiGroupAdd:", data);
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
    };
    setTimeout(() => {
      resolve(res);
    }, 50);
  });
}
/**
 * 用户分组管理-删除分组
 * @param {number} data.id - 分组id
 */
function apiGroupDelete(data) {
  console.log("apiGroupDelete:", data);
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
    };
    setTimeout(() => {
      resolve(res);
    }, 50);
  });
}
/**
 * 用户分组管理-修改分组
 * @param {number} data.id - 分组id
 * @param {string} data.name - 分组名
 */
function apiGroupEdit(data) {
  console.log("apiGroupEdit:", data);
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
    };
    setTimeout(() => {
      resolve(res);
    }, 50);
  });
}
/**
 * 用户分组管理-获取用户列表
 * @param {number} data.pageNumber - 当前页
 * @param {number} data.pageSize - 每页条数
 * @param {string} data.name - 用户名
 * @param {string} data.cate - 分类id
 * @param {string} data.area - 区域id
 * @param {string} data.groupId - 组id
 * @param {string} data.bindService - 是否绑定服务号: 1: 已绑定 0: 未绑定
 */
function apiGetAllUserList(data) {
  console.log("apiGetAllUserList:", data);
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
      total: 66,
      data: [
        {
          id: 1,
          name: "张三",
          bind_service: 1,
          bind_app: 1,
          state: 1, // 0: 未添加 1: 已添加
        },
        {
          id: 2,
          name: "李四",
          bind_service: 0,
          bind_app: 0,
          state: 0,
        },
        {
          id: 3,
          name: "王五",
          bind_service: 1,
          bind_app: 0,
          state: 0,
        },
        {
          id: 4,
          name: "赵六",
          bind_service: 0,
          bind_app: 1,
          state: 1,
        },
        {
          id: 5,
          name: "田七",
          bind_service: 1,
          bind_app: 1,
          state: 0,
        },
        {
          id: 6,
          name: "王八",
          bind_service: 0,
          bind_app: 0,
          state: 1,
        },
        {
          id: 7,
          name: "九九",
          bind_service: 1,
          bind_app: 0,
          state: 0,
        },
        {
          id: 8,
          name: "九九",
          bind_service: 0,
          bind_app: 1,
          state: 0,
        },
        {
          id: 9,
          name: "九九",
          bind_service: 1,
          bind_app: 1,
          state: 0,
        },
        {
          id: 10,
          name: "九九",
          bind_service: 0,
          bind_app: 0,
          state: 0,
        },
      ],
    };
    setTimeout(() => {
      resolve(res);
    }, 500);
  });
}
/**
 * 获取分类列表
 */
function apiGetCateList() {
  console.log("apiGetCateList");
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
      data: [
        {
          id: 1,
          name: "分类1",
          children: [
            {
              id: 11,
              name: "分类1-1",
            },
            {
              id: 12,
              name: "分类1-2",
            },
          ],
        },
        {
          id: 2,
          name: "分类2",
          children: [
            {
              id: 21,
              name: "分类2-1",
            },
            {
              id: 22,
              name: "分类2-2",
              children: [],
            },
          ],
        },
        {
          id: 3,
          name: "分类3",
          children: [],
        },
        {
          id: 4,
          name: "分类4",
          children: [],
        },
      ],
    };
    setTimeout(() => {
      resolve(res);
    }, 500);
  });
}
/**
 * 获取区域列表
 */
function apiGetAreaList() {
  console.log("apiGetAreaList");
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
      data: [
        {
          id: 1,
          name: "区域1",
          children: [
            {
              id: 11,
              name: "区域1-1",
            },
            {
              id: 12,
              name: "区域1-2",
            },
          ],
        },
        {
          id: 2,
          name: "区域2",
          children: [
            {
              id: 21,
              name: "区域2-1",
            },
          ],
        },
        {
          id: 3,
          name: "区域3",
        },
        {
          id: 4,
          name: "区域4",
        },
      ],
    };
    setTimeout(() => {
      resolve(res);
    }, 500);
  });
}
/**
 * 添加用户到分组
 * @param {number} data.groupId - 分组id
 * @param {number} data.userIds - 用户id
 */
function apiAddUserToGroup(data) {
  console.log("apiAddUserToGroup:", data);
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
    };
    setTimeout(() => {
      resolve(res);
    }, 50);
  });
}
/**
 * 从分组中删除用户
 * @param {number} data.groupId - 分组id
 * @param {number} data.userIds - 用户id
 */
function apiDeleteUserFromGroup(data) {
  console.log("apiDeleteUserFromGroup:", data);
  return new Promise((resolve, reject) => {
    const res = {
      code: 200,
    };
    setTimeout(() => {
      resolve(res);
    }, 50);
  });
}
